package com.tmeone.erpone.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tmeone.erpone.entity.Product;
import com.tmeone.erpone.entity.TProduct;
import com.tmeone.erpone.mapper.ProductMapper;
import com.tmeone.erpone.mapper.TProductMapper;
import com.tmeone.erpone.service.IProductService;
import com.tmeone.erpone.service.ITProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tmeone
 * @since 2021-04-19
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {

    @Autowired
    private ProductMapper productMapper;
    //商品分页
    @Override
    public IPage<Product> pageProducts(IPage<Product> page) {
        return productMapper.pageProducts(page);
    }

    @Override
    public IPage<Product> pageProductsManagement(IPage<Product> page) {
        return productMapper.pageProductsManagement(page);
    }

    //通过商品名称查询
    @Override
    public IPage<Product> findProductByName(IPage<Product> page, String productName) {
        return productMapper.selectProductByName(page,productName);
    }

    @Override
    public Product findProductById(String id) {
        return productMapper.selectProductById(id);
    }
}
